//
//  KVEmoticonButton.swift
//  KVEmoticon
//
//  Created by 李康卫 on 16/7/30.
//  Copyright © 2016年 李康卫. All rights reserved.
//

import UIKit

class KVEmoticonButton: UIButton {
    ///模型
    var emoticonModel: KVEmoticonModel? {
        didSet {
            if let emoji = emoticonModel!.emoji {
                self.setTitle(emoji, forState: UIControlState.Normal)
                self.setImage(nil, forState: UIControlState.Normal)
                //设置属性、
            } else {
                //取消文字显示图片
                self.setTitle(nil, forState: UIControlState.Normal)
                self.setImage(UIImage(named: emoticonModel!.iconPath!), forState: UIControlState.Normal)
            }
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.titleLabel?.font = UIFont.systemFontOfSize(32)

    }
}
